home *** CD-ROM | disk | FTP | other *** search
/ Tech Win 1995 November / CD [TECH_B].bin / tech_b / delphi / trial / disk4 / doc.pak / BUTTONS.INT < prev    next >
Encoding:
Text File  |  1995-08-08  |  3.3 KB  |  102 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       Delphi Visual Component Library                 }
  4. {                                                       }
  5. {       Copyright (c) 1995 Borland International        }
  6. {                                                       }
  7. {*******************************************************}
  8.  
  9. unit Buttons;
  10.  
  11. {$S-,W-,R-}
  12. {$C PRELOAD}
  13.  
  14. interface
  15.  
  16. uses WinTypes, WinProcs, Messages, Classes, Controls, Forms, Graphics,
  17.   StdCtrls, ExtCtrls;
  18.  
  19. type
  20.   TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom);
  21.   TButtonState = (bsUp, bsDisabled, bsDown, bsExclusive);
  22.   TButtonStyle = (bsAutoDetect, bsWin31, bsNew);
  23.   TNumGlyphs = 1..4;
  24.  
  25.   TSpeedButton = class(TGraphicControl)
  26.   protected
  27.     FState: TButtonState;
  28.     function GetPalette: HPALETTE; override;
  29.     procedure Paint; override;
  30.     procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
  31.       X, Y: Integer); override;
  32.     procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
  33.     procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
  34.       X, Y: Integer); override;
  35.   public
  36.     constructor Create(AOwner: TComponent); override;
  37.     destructor Destroy; override;
  38.     procedure Click; override;
  39.   published
  40.     property AllowAllUp: Boolean default False;
  41.     property GroupIndex: Integer default 0;
  42.   { Ensure group index is declared before Down }
  43.     property Down: Boolean default False;
  44.     property Caption;
  45.     property Enabled;
  46.     property Font;
  47.     property Glyph: TBitmap;
  48.     property Layout: TButtonLayout default blGlyphLeft;
  49.     property Margin: Integer default -1;
  50.     property NumGlyphs: TNumGlyphs default 1;
  51.     property ParentFont;
  52.     property ParentShowHint;
  53.     property ShowHint;
  54.     property Spacing: Integer default 4;
  55.     property Visible;
  56.     property OnClick;
  57.     property OnDblClick;
  58.     property OnMouseDown;
  59.     property OnMouseMove;
  60.     property OnMouseUp;
  61.   end;
  62.  
  63.   TBitBtnKind = (bkCustom, bkOK, bkCancel, bkHelp, bkYes, bkNo, bkClose,
  64.     bkAbort, bkRetry, bkIgnore, bkAll);
  65.  
  66.   TBitBtn = class(TButton)
  67.   protected
  68.     procedure CreateParams(var Params: TCreateParams); override;
  69.     function GetPalette: HPALETTE; override;
  70.     procedure SetButtonStyle(ADefault: Boolean); override;
  71.   public
  72.     constructor Create(AOwner: TComponent); override;
  73.     destructor Destroy; override;
  74.     procedure Click; override;
  75.   published
  76.     property Cancel stored IsCustom;
  77.     property Caption stored IsCustomCaption;
  78.     property Default stored IsCustom;
  79.     property Enabled;
  80.     property Glyph: TBitmap;
  81.     property Kind: TBitBtnKind default bkCustom;
  82.     property Layout: TButtonLayout default blGlyphLeft;
  83.     property Margin: Integer default -1;
  84.     property ModalResult stored IsCustom;
  85.     property NumGlyphs: TNumGlyphs default 1;
  86.     property ParentShowHint;
  87.     property ShowHint;
  88.     property Style: TButtonStyle default bsAutoDetect;
  89.     property Spacing: Integer default 4;
  90.     property TabOrder;
  91.     property TabStop;
  92.     property Visible;
  93.     property OnEnter;
  94.     property OnExit;
  95.   end;
  96.  
  97. function DrawButtonFace(Canvas: TCanvas; const Client: TRect;
  98.   BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown,
  99.   IsFocused: Boolean): TRect;
  100.  
  101. implementation
  102.